﻿package soundCom 
{
	import debugs.Debug;
	import flash.display.MovieClip;
	import media.soundItem;
	import flash.events.Event;
	import media.fixSound;
	import net.netvars;
	/**
	 * ...
	 * @author keys_star@163.com
	 */
	public class pass extends MovieClip
	{
		private var soundArr:Array;
		public var type:String;
		public function pass() 
		{
			gotoAndStop(4);
		}
		public function init() {
			gotoAndStop(4);
		}
		public function win() {
			var u:String = "sound/";
			Debug.send(this + ".win");
			type = "win";
			gotoAndStop(2);
			soundArr = new Array();
			soundArr.push(u+19);
			soundArr.push(u+13);
			var n:Number = Number(netvars.getVar("MONEY"));
			var numArr:Array = fixSound.getNumSound(n, "sound");
			Debug.send(this+".win.sound: "+numArr)
			soundArr = soundArr.concat(numArr);
			soundArr.push(u+14);
			soundArr.push(u+15);
			var si:soundItem = new soundItem;
			si.addEventListener(Event.SOUND_COMPLETE, wcom);
			si.soundArr = soundArr;
			si.play();
		}
		public function lose() {
			Debug.send(this + ".lose");
			var u:String = "sound/";
			type = "lose";
			gotoAndStop(1);
			soundArr = new Array(u+17, u+16, u+12, u+18);
			var si:soundItem = new soundItem;
			si.addEventListener(Event.SOUND_COMPLETE, lcom);
			si.soundArr = soundArr;
			si.play();
		}
		private function wcom(e:Event) {
			Debug.send(this+".win.com")
			dispatchEvent(e);
		}
		private function lcom(e:Event) {
			Debug.send(this+".lose.com")
			dispatchEvent(new Event(Event.CHANGE));
		}
	}
}